<template>
  <el-dialog v-model="model" @close="closedDialog">
    <el-image :src="url" alt="流程图" />
  </el-dialog>
</template>
<script setup lang="ts">
import { ref, type PropType } from "vue";
const url = ref("");
import { type ProcDefKey } from "@/api/flow/prodef/types";
import { procDefApi } from "@/api/flow/prodef/index";

const props = defineProps({
  entityKey: {
    type: Object as PropType<ProcDefKey>,
    default: () => {},
  },
});

if (props.entityKey.procDefId) {
  procDefApi.findProcDefDiagram(props.entityKey.procDefId).then((res) => {
    url.value = window.URL.createObjectURL(res.data);
  });
}

const model = defineModel<boolean>();
// 关闭弹框
function closedDialog() {
  if (model.value) {
    model.value = false;
  }
}
</script>
